/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.test.app.email;
import javax.mail.internet.MimeMessage;
import org.springframework.mail.*;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMailMessage;
/**
 *
 * @author darshana
 */
public class Email {

    private JavaMailSender mailSender;
    //private SimpleMailMessage simpleMailMessage;

    public void setMailSender(JavaMailSender mailSender) {
        this.mailSender = mailSender;
    }

//    public void setSimpleMailMessage(SimpleMailMessage simpleMailMessage) {
//        this.simpleMailMessage = simpleMailMessage;
//    }


//
//    public void setMailSender(MailSender mailSender) {
//        this.mailSender = mailSender;
//    }
//
    public void sendEmail() throws Exception {


        MimeMessage mimeMessage=mailSender.createMimeMessage();
        Preparator preparator=new Preparator();
        preparator.prepare(mimeMessage);
        mailSender.send(preparator);




//        SimpleMailMessage message = new SimpleMailMessage(this.simpleMailMessage);
//        //message.setFrom(from);
//        message.setTo(to);
//        message.setSubject(subject);
//        message.setText(text);
//        this.mailSender.send(message);

    }




}
